




/*
'===============================================================================
'  LinqHelper.DAO.HotelInfosBase
'===============================================================================
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using LinqHelper;
using LinqHelper.Entity;
using LinqHelper.DAO;

namespace LinqHelper.DAO
{
	public class LqHotelInfosBase
	{
		public LqProvider provider = new LqProvider();
		
		/// <summary>
		/// Purpose: Class constructor.
		/// </summary>
		public LqHotelInfosBase()
		{
			// Nothing for now.
		}
		
		public void Insert(LqHotelInfosEntity obj)
		{
			provider.GetTable<LqHotelInfosEntity>().InsertOnSubmit(obj);
            provider.SubmitChanges();
		}

		public void Update(LqHotelInfosEntity _obj)
		{
			var q = from obj in provider.GetTable<LqHotelInfosEntity>()
                    where obj.Id == _obj.Id
                    select obj;
			LqHotelInfosEntity tmp = q.First<LqHotelInfosEntity>();
			
			tmp.HotelId = _obj.HotelId;
			tmp.Lang = _obj.Lang;
			tmp.HotelName = _obj.HotelName;
			tmp.Address = _obj.Address;
			tmp.InfoContents = _obj.InfoContents;
			tmp.InfoRooms = _obj.InfoRooms;
			provider.SubmitChanges();
		}
		
		public void Delete(LqHotelInfosEntity obj)
		{
			provider.GetTable<LqHotelInfosEntity>().DeleteOnSubmit(obj);
            provider.SubmitChanges();
		}
		
		
		public void DeleteById(Guid Id)
		{
			var q = from obj in provider.GetTable<LqHotelInfosEntity>()
                    where obj.Id == Id
                    select obj;
					
            LqHotelInfosEntity ob = (LqHotelInfosEntity)q.First<LqHotelInfosEntity>();
            provider.GetTable<LqHotelInfosEntity>().DeleteOnSubmit(ob);
            provider.SubmitChanges();
		}
		
		
		public void DeleteByHotelId(Guid HotelId)
		{
			var q = from obj in provider.GetTable<LqHotelInfosEntity>()
                    where obj.HotelId == HotelId
                    select obj;
					
            LqHotelInfosEntity ob = (LqHotelInfosEntity)q.First<LqHotelInfosEntity>();
            provider.GetTable<LqHotelInfosEntity>().DeleteOnSubmit(ob);
            provider.SubmitChanges();
		}
		
		
		public void DeleteByLang(string Lang)
		{
			var q = from obj in provider.GetTable<LqHotelInfosEntity>()
                    where obj.Lang == Lang
                    select obj;
					
            LqHotelInfosEntity ob = (LqHotelInfosEntity)q.First<LqHotelInfosEntity>();
            provider.GetTable<LqHotelInfosEntity>().DeleteOnSubmit(ob);
            provider.SubmitChanges();
		}
		
		
		public void DeleteByHotelName(string HotelName)
		{
			var q = from obj in provider.GetTable<LqHotelInfosEntity>()
                    where obj.HotelName == HotelName
                    select obj;
					
            LqHotelInfosEntity ob = (LqHotelInfosEntity)q.First<LqHotelInfosEntity>();
            provider.GetTable<LqHotelInfosEntity>().DeleteOnSubmit(ob);
            provider.SubmitChanges();
		}
		
		
		public void DeleteByAddress(string Address)
		{
			var q = from obj in provider.GetTable<LqHotelInfosEntity>()
                    where obj.Address == Address
                    select obj;
					
            LqHotelInfosEntity ob = (LqHotelInfosEntity)q.First<LqHotelInfosEntity>();
            provider.GetTable<LqHotelInfosEntity>().DeleteOnSubmit(ob);
            provider.SubmitChanges();
		}
		
		
		public void DeleteByInfoContents(string InfoContents)
		{
			var q = from obj in provider.GetTable<LqHotelInfosEntity>()
                    where obj.InfoContents == InfoContents
                    select obj;
					
            LqHotelInfosEntity ob = (LqHotelInfosEntity)q.First<LqHotelInfosEntity>();
            provider.GetTable<LqHotelInfosEntity>().DeleteOnSubmit(ob);
            provider.SubmitChanges();
		}
		
		
		public void DeleteByInfoRooms(string InfoRooms)
		{
			var q = from obj in provider.GetTable<LqHotelInfosEntity>()
                    where obj.InfoRooms == InfoRooms
                    select obj;
					
            LqHotelInfosEntity ob = (LqHotelInfosEntity)q.First<LqHotelInfosEntity>();
            provider.GetTable<LqHotelInfosEntity>().DeleteOnSubmit(ob);
            provider.SubmitChanges();
		}
		
		
		public LqHotelInfosEntity SelectOne(Guid Id)
		{
			var query = from obj in provider.GetTable<LqHotelInfosEntity>()
                        where obj.Id == Id
                        select obj;
            return query.First<LqHotelInfosEntity>();
		}

		public List<LqHotelInfosEntity> SelectAll()
		{
			var query = from obj in provider.GetTable<LqHotelInfosEntity>()
                        select obj;
            return query.ToList<LqHotelInfosEntity>();
		}
		
		
		public List<LqHotelInfosEntity> SelectById(Guid Id)
		{
			var query = from obj in provider.GetTable<LqHotelInfosEntity>()
                        where obj.Id == Id
                        select obj;
            return query.ToList<LqHotelInfosEntity>();
		}
		
		
		public List<LqHotelInfosEntity> SelectByHotelId(Guid HotelId)
		{
			var query = from obj in provider.GetTable<LqHotelInfosEntity>()
                        where obj.HotelId == HotelId
                        select obj;
            return query.ToList<LqHotelInfosEntity>();
		}
		
		
		public List<LqHotelInfosEntity> SelectByLang(string Lang)
		{
			var query = from obj in provider.GetTable<LqHotelInfosEntity>()
                        where obj.Lang == Lang
                        select obj;
            return query.ToList<LqHotelInfosEntity>();
		}
		
		
		public List<LqHotelInfosEntity> SelectByHotelName(string HotelName)
		{
			var query = from obj in provider.GetTable<LqHotelInfosEntity>()
                        where obj.HotelName == HotelName
                        select obj;
            return query.ToList<LqHotelInfosEntity>();
		}
		
		
		public List<LqHotelInfosEntity> SelectByAddress(string Address)
		{
			var query = from obj in provider.GetTable<LqHotelInfosEntity>()
                        where obj.Address == Address
                        select obj;
            return query.ToList<LqHotelInfosEntity>();
		}
		
		
		public List<LqHotelInfosEntity> SelectByInfoContents(string InfoContents)
		{
			var query = from obj in provider.GetTable<LqHotelInfosEntity>()
                        where obj.InfoContents == InfoContents
                        select obj;
            return query.ToList<LqHotelInfosEntity>();
		}
		
		
		public List<LqHotelInfosEntity> SelectByInfoRooms(string InfoRooms)
		{
			var query = from obj in provider.GetTable<LqHotelInfosEntity>()
                        where obj.InfoRooms == InfoRooms
                        select obj;
            return query.ToList<LqHotelInfosEntity>();
		}
		
		
		

	}
}
